<?php require_once LAYOUTPATH.'layout_header.php'; ?>

<h1><?php echo $page_title; ?></h1>

<div id="bricabox_tabs" class="admin">
	<ul>
		<li class="back"><a href="/">&lsaquo; Back to your BricaBox</a></li>
		<?php render_tabs($admin_tabs); ?>
	</ul>
	<ul id="sub_tabs">
		<li><a href="/admin/general/basic">Basic</a></li>
		<li class="current"><a href="/admin/general/terms">Interaction</a></li>
		<li><a href="/admin/general/appearance">Appearance</a></li>
		<li><a href="/admin/general/domain">Domain name</a></li>
	</ul>
</div>

<?php require_once FLASHPARTIAL; ?>

<p class="info_pee">About interaction</p>

<form action="/bricabox/<?php echo $bricabox->id; ?>/save_interaction" method="post" onsubmit="return Terms.checkForm();">
	<input type="hidden" name="section" value="general" />
	<input type="hidden" name="view" value="terms" />
	<fieldset>
		<div>
			<input<?php if ($bricabox->use_field2 == 1) echo ' checked="checked"'; ?> type="radio" name="int_hash" value="<?php echo url_safe_base64("use_field2:1,engage_button_label:Vote,engage_term_past_tense:voted", 'encode'); ?>" />
			<input type="button" value="Vote" />
			&rarr; You voted
		</div>
		
		<div>
			<input<?php if ($bricabox->use_field2 == 2) echo ' checked="checked"'; ?> type="radio" name="int_hash" value="<?php echo url_safe_base64("use_field2:2,engage_button_label:I Agree,engage_term_past_tense:agreed", 'encode'); ?>" />
			<input type="button" value="I Agree" />
			&rarr; You agreed
		</div>
		
		<div>
			<input<?php if ($bricabox->allow_engagement && $bricabox->engagement_type == 'fivestar') echo ' checked="checked"'; ?> type="radio" name="int_hash" value="fivestar" />
			<img src="/assets/images/icons/star.png" alt="*" /><img src="/assets/images/icons/star.png" alt="*" /><img src="/assets/images/icons/star.png" alt="*" /><img src="/assets/images/icons/star.png" alt="*" /><img src="/assets/images/icons/star.png" alt="*" />
			&rarr; You rated this
			<img src="/assets/images/icons/star.png" alt="*" /><img src="/assets/images/icons/star.png" alt="*" />
		</div>
		
		<?php $do_custom = ($bricabox->allow_engagement && $bricabox->engagement_type == 'button' && $bricabox->use_field2 == 33) ? true : false; ?>
		<div class="opt_group">
			<input<?php if ($do_custom) echo ' checked="checked"'; ?> type="radio" name="int_hash" value="custom_terms" id="custom_terms" onclick="$('#fields_for_custom_terms').show();" />
			<label for="custom_terms">I want to use custom terms:</label>
			<div class="inner"<?php if (!$do_custom) echo ' style="display: none;"'; ?> id="fields_for_custom_terms">
				<div>
					<label for="custom_button_label"><span class="req">*</span>Button label:</label><br />
					<input type="text" name="engage_button_label" id="custom_button_label" value="<?php echo @$bricabox->engage_button_label; ?>" />
				</div>
				
				<div>
					<label for="custom_past_tense"><span class="req">*</span>Past tense term for interacting (e.g. voted, agreed, cast your vote):</label><br />
					You already <input type="text" name="engage_term_past_tense" id="custom_past_tense" value="<?php echo @$bricabox->engage_term_past_tense; ?>" />
				</div>
			</div>
		</div>
		
		<script type="text/javascript" charset="utf-8">
			var Terms = {
				checkForm: function()
				{
					var el=$('#custom_terms');
					if (el.attr('checked'))
					{
						if (!$('#custom_button_label').val() || !$('#custom_past_tense').val())
						{
							alert('You must enter both a button label and a past tense term.');
							return false;
						}
					}
				}
			}
		</script>
		
		<div>
			<input<?php if (!$bricabox->allow_engagement) echo ' checked="checked"'; ?> type="radio" id="eng_none" name="int_hash" value="none" />
			<label for="eng_none">Don't allow interaction on this BricaBox</label>
		</div>
		
		<div class="controls">
			<input type="submit" value="Save changes" />
			or <a href="/admin">cancel</a>
		</div>
	</fieldset>
</form>

<div class="big_info_box">
	<h4>How can I change site interaction?</h4>
	<p>The type of content you're using BricaBox for determines what kind of interaction you want users to have on your site. For BricaBoxes with reviews (restaurant, movies, etc.) a 5-star method is usually preferred. However, if you're using BricaBox as a blog or a wiki, you may not want any interaction at all. It's up to you!</p>
</div>

<?php require_once LAYOUTPATH.'layout_footer.php'; ?>